package cn.wolfcode.car.controller;

import cn.wolfcode.car.domain.Business;
import cn.wolfcode.car.domain.SystemDictionaryItem;
import cn.wolfcode.car.service.IBusinessService;
import cn.wolfcode.car.service.ISystemDictionaryItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private IBusinessService businessService;
    @Autowired
    private ISystemDictionaryItemService systemDictionaryItemService;

    @RequestMapping("/index")
    public String show(Model model) {
        Business business = businessService.getMainStore();
        model.addAttribute("business", business);
        List<SystemDictionaryItem> list = systemDictionaryItemService.getByType(1L);
        model.addAttribute("list", list);
        return "index";
    }
}
